package com.tanhua.server.controller;

import com.tanhua.server.service.TodayBestService;
import com.tanhua.server.vo.RecommendUserQueryParam;
import com.tanhua.server.utils.Cache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/tanhua")
@RestController
public class TodayBestController {

    @Autowired
    private TodayBestService todayBestService;

    /**
     * 查询今日佳人
     *
     * @return
     */
    @GetMapping("/todayBest") //todayBest2
    @Cache(time = "90")
    public Object queryTodayBest() {
        //先从缓存中命中，如果命中就返回，如果没有，就执行后续的流程
        Object obj = this.todayBestService.queryTodayBest();
        //将数据写入到redis中
        return obj;
    }

    /**
     * 查询推荐用户列表
     *
     * @param queryParam
     * @return
     */
    @GetMapping("recommendation")
    public Object queryRecommendation(RecommendUserQueryParam queryParam) {
        return this.todayBestService.queryRecommendation(queryParam);
    }

}
